using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using VOL.Entity.DomainModels;

namespace VOL.demo.IRepositories
{
    public partial interface ISalesReturnOrderModelRepository
    {
        /// <summary>
        /// 分页查询销售退货订单（带关联查询和计算字段）
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="orderCode">退货单号</param>
        /// <param name="status">单据状态</param>
        /// <param name="supplierId">供应商ID</param>
        /// <param name="returnDate">退货日期</param>
        /// <returns>分页结果</returns>
        Task<(List<SalesReturnOrderModel> Data, int TotalCount)> GetSalesReturnOrderPageListAsync(
            int pageIndex, 
            int pageSize, 
            string orderCode = null, 
            int? status = null, 
            long? supplierId = null, 
            DateTime? returnDate = null);

        /// <summary>
        /// 根据销售单号查询销售明细列表（包含已出库、未出库等信息）
        /// </summary>
        /// <param name="shopOrderCode">销售单号</param>
        /// <returns>销售明细列表</returns>
        Task<List<SalesOrderDetailForReturnDto>> GetSalesOrderDetailsByCodeAsync(string shopOrderCode);

        /// <summary>
        /// 生成退货单号
        /// </summary>
        /// <returns>退货单号</returns>
        Task<string> GenerateReturnOrderCodeAsync();

        /// <summary>
        /// 保存销售退货订单（包括主表和明细表）
        /// </summary>
        /// <param name="mainData">主表数据</param>
        /// <param name="detailData">明细数据</param>
        /// <returns>保存结果</returns>
        Task<(bool Success, string Message, long OrderId)> SaveSalesReturnOrderAsync(
            SalesReturnOrderModel mainData, 
            List<SalesReturnOrderItemModel> detailData);
    }
}

